package ups.proyecto.fin.hotel1.util;

import java.io.IOException;
import java.util.Properties;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

@Named
@ApplicationScoped
public class Propiedad {
	
	Logger log = Logger.getLogger(this.getClass().getName());

	private Properties prop;

	public Propiedad() {
		super();
	}

	@PostConstruct
	public void afterCreate() {
		log.info("[LITO] Inicializacion de parametros gmail.properties");
		prop = new Properties();
		try {
			prop.load(getClass().getClassLoader().getResourceAsStream(
					"resources/config/mail/gmail.properties"));
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}

	public String getPropiedad(String propiedad) {
		try {
			return prop.getProperty(propiedad);
		} catch (NullPointerException en) {
			en.printStackTrace();
			return null;
		}
	}

}